package ch09.d2;

import org.junit.Test;
import java.util.TreeSet;

public class TreeSetTest {
    @Test
    public void testStudentTree(){
        TreeSet<Student> set=new TreeSet<Student>( (x,y)->x.score-y.score);

        Student s1=new Student("孙悟空",100,"123456","花果山");
        Student s2=new Student("猪八戒",200,"123456","高老庄");
        set.add(s1);
        set.add(s2);
        set.add(new Student("沙和尚",300,"123456","流沙河"));
        set.add(new Student("唐僧",400,"123456","长安"));
        set.add(new Student("白龙马",101,"123456","东海"));


        for (Student student : set) {
            System.out.println(student);
        }


    }
}
